package com.example.sendsms;

import android.content.Context;
import android.util.Log;
import android.view.View;
import android.view.ViewGroup;
import android.widget.BaseAdapter;

import com.example.sendsms.model.Result;

import java.util.List;

public class MainAdapter extends BaseAdapter {

    private List<Result> mList;
    private Context context;
    private int checkedPosition;

    public MainAdapter(List<Result> mList, Context context) {
        this.mList = mList;
        this.context = context;
    }

    @Override
    public int getCount() {
        Log.d("TAH", String.valueOf(mList.size()));
        return mList.size();
    }

    @Override
    public Object getItem(int position) {
        return mList.get(position);
    }

    @Override
    public long getItemId(int position) {
        return position;
    }

    @Override
    public View getView(int position, View convertView, ViewGroup parent) {
        ChoiceView view = null;
        if(convertView==null){
            view = new ChoiceView(context);
        }else{
            view = (ChoiceView) convertView;
        }
        view.setTextView("第"+ position +"组数据");
        return view;
    }

}